package com.hdey.service.max.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hdey.mapper.max.TbUscSupplySupclaMapper;
import com.hdey.pojo.max.TbUscSupplySupcla;
import com.hdey.service.max.TbUscSupplySupclaSvs;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service("tbUscSupplySupclaSvs")
@Transactional
@Slf4j
public class TbUscSupplySupclaSvsImpl extends ServiceImpl<TbUscSupplySupclaMapper, TbUscSupplySupcla> implements TbUscSupplySupclaSvs{

    @Resource
    private TbUscSupplySupclaMapper mapper;


    @Override
    public int create(Integer supplyId, Integer[] supclaIds){

        //System.out.println("供应商Id"+ supplyId);

        int result = 0;
        TbUscSupplySupcla supplySupcla = new TbUscSupplySupcla();
        supplySupcla.setSupplyId(supplyId);

        for(Integer supclaId : supclaIds){
           // System.out.println(supclaId);
            supplySupcla.setSupclaId(supclaId);
            //System.out.println(supplySupcla.toString());
            result = mapper.insert(supplySupcla);
        }
        return result;
    }



}
